﻿using System;
using System.Linq;

namespace CodeContribBlog.Data
{
	public static class PostExtensions
	{
		public static IQueryable<Post> WhereIsPublic(this IQueryable<Post> query)
		{
			var now = DateTime.UtcNow;

			return query.Where(p => !p.IsDeleted && p.PublishedAt <= now);
		}
	}
}